//
//  WMProductsTool.h
//  WonderPurchaseSDK
//
//  Created by zero on 2021/7/20.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef void (^WMProductsRequestFailureBlock)(NSError *error);

typedef void (^WMProductsRequestSuccessBlock)(NSArray *products);

@interface WMProductsTool : NSObject<SKProductsRequestDelegate>


/// 商品id
@property (nonatomic, copy) NSSet *productSet;

/// 商品数组
@property (nonatomic, strong) NSMutableArray *products;

/// 商品ID数组
@property (nonatomic, strong) NSArray *productIdentifiers;


+ (instancetype)sharedTool;


/// 请求在线商品
/// @param identifiers 商品ID
- (void)requestProducts:(NSSet *)identifiers;


/// 请求在线商品
/// @param identifiers 商品ID
/// @param successBlock 请求成功回调
/// @param failureBlock 请求失败回调
- (void)requestProducts:(NSSet *)identifiers
                success:(WMProductsRequestSuccessBlock)successBlock
                failure:(WMProductsRequestFailureBlock)failureBlock;

@end

NS_ASSUME_NONNULL_END
